#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include<QHash>
#include"peopleitem.h"
#include"addpeople.h"
#include"sendmesitem.h"
#include<QTcpSocket>
#include<QJsonObject>
#include<QJsonDocument>
#include<QSql>
#include<QSqlDatabase>
#include<QSqlQuery>
#include"newfriendlist.h"
#include"privateinfo.h"
QT_BEGIN_NAMESPACE
namespace Ui {
class widget;
}
QT_END_NAMESPACE

class widget : public QWidget
{
    Q_OBJECT

public:
    widget();
    ~widget();
    int nextpeoplerow=0;
    QHash<QString,peopleitem*> Peopleitems_account;  //通过账户检索peopleitem
    QHash<int,peopleitem*>Peopleitems_row;    //通过列表行号检索
    int nextpeopleitemrow=0;
    QTcpSocket* Tso;
    addpeople* Ap;
    peopleitem* Curpeoitem;
    QString Name;
    QString Account;  //账号
    QImage HeadImage;
    QString HeadImagePath;
    QJsonObject loginjo;  //loginjo发来的
    newfriendlist* nfl;
    privateinfo* priinfo;  //个人信息编辑
    privateinfo* otherinfo;   //他人信息查看
    QString Personalsign;
    QSqlDatabase sd;
    QSqlQuery* sq;
    bool newjo=false;


public:
    void init(QTcpSocket*tso,QString account,QString name,QImage headimage,QString headimagepath,QString personalsign);
    void ConnectSignal();
    void loaddata();
    void renewinfo();
private slots:
    void on_sendmesbtn_clicked();
    void on_addpeoplebtn_clicked();
    void on_SendMesEdit_textChanged();

    void on_peopleitemlist_currentRowChanged(int currentRow);

    void on_newpeople_clicked();

    void on_headimage_clicked();

    void on_peopleitemlist_itemDoubleClicked(QListWidgetItem *item);

private:
    Ui::widget *ui;
};
#endif // WIDGET_H
